/*
 * 文件名称: SKUserFRDetailServiceImpl.java
 * 版权信息: Copyright 2001-2017 hangzhou jingshu technology Co., LTD. All right reserved.
 * ----------------------------------------------------------------------------------------------
 * 修改历史:
 * ----------------------------------------------------------------------------------------------
 * 修改原因: 新增
 * 修改人员: fankd
 * 修改日期: 2019-9-20
 * 修改内容: 
 */
package com.kensure.shike.user.service;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import co.kensure.frame.JSBaseService;
import co.kensure.mem.CollectionUtils;
import co.kensure.mem.MapUtils;

import com.kensure.basekey.BaseKeyService;
import com.kensure.shike.user.dao.SKUserFRDetailDao;
import com.kensure.shike.user.model.SKUserFRDetail;


/**
 * 订单分润明细服务实现类
 * @author fankd created on 2019-9-20
 * @since 
 */
@Service
public class SKUserFRDetailService extends JSBaseService{
	
	@Resource
	private SKUserFRDetailDao dao;
	@Resource
	private BaseKeyService baseKeyService;
    
    public SKUserFRDetail selectOne(Long id){
    	return dao.selectOne(id);
    }
	
	public List<SKUserFRDetail> selectByIds(Collection<Long> ids){
		return dao.selectByIds(ids);
	}
	
	public List<SKUserFRDetail> selectByWhere(Map<String, Object> parameters){
		return dao.selectByWhere(parameters);
	}
	
	public long selectCountByWhere(Map<String, Object> parameters){
		return dao.selectCountByWhere(parameters);
	}
	
	
	public boolean insert(SKUserFRDetail obj){
		super.beforeInsert(obj);
		obj.setId(baseKeyService.getKey("sk_user_fr_order"));
		obj.setStatus(0);
		return dao.insert(obj);
	}
	
	/**
	 * 根据订单明细id获取分润明细情况
	 * 
	 * @param orderid
	 * @param paytype
	 * @return
	 */
	public List<SKUserFRDetail> selectByfinpayid(Long finpayid) {
		Map<String, Object> parameters = MapUtils.genMap("finpayid", finpayid);
		List<SKUserFRDetail> list = selectByWhere(parameters);
		return list;
	}
	
	
	/**
	 * 根据订单获取分润情况
	 * 
	 * @param orderid
	 * @param paytype
	 * @return
	 */
	public SKUserFRDetail selectByOrderid(Long orderid) {
		Map<String, Object> parameters = MapUtils.genMap("orderid", orderid);
		List<SKUserFRDetail> list = selectByWhere(parameters);
		SKUserFRDetail fr = null;
		if (CollectionUtils.isNotEmpty(list)) {
			fr = list.get(0);
		}
		return fr;
	}
	
	
	public boolean update(SKUserFRDetail obj){
		super.beforeUpdate(obj);
		return dao.update(obj);
	}
    
    public boolean updateByMap(Map<String, Object> params){
		return dao.updateByMap(params);
	}
    
    
	public boolean delete(Long id){
		return dao.delete(id);
	}	
	
    public boolean deleteMulti(Collection<Long> ids){
		return dao.deleteMulti(ids);
	}
    
    public boolean deleteByWhere(Map<String, Object> parameters){
		return dao.deleteByWhere(parameters);
	}
    
    
  

}
